// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // // // Project: Talina Gaming System (TgS) (∂) // File: TgS Collision - Tools [Debug].h // Author: Andrew Aye (EMail: andrew.aye@gmail.com, Web: http://www.andrewaye.com) // Version: 3.11 // // ------------------------------------------------------------------------------------------------------------------------------ // // // Copyright: © 2002-2008, Andrew Aye. All Rights Reserved. // // This software is free for non-commercial use. Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // Redistributions of source code must retain this copyright notice, this list of conditions and the following disclaimers. // Redistributions in binary form must reproduce this copyright notice, this list of conditions and the following // disclaimers in the documentation and other materials provided with the distribution. // // Neither the names of the copyright owner nor the names of its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // The intellectual property rights of the algorithms used reside with Andrew Aye. You may not use this software, in whole or // in part, in support of any commercial product without the express written consent of the author. // // There is no warranty or other guarantee of fitness of this software for any purpose. It is provided solely "as is". // // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // #if !defined(_TGS_COLLISION_TOOLS_DEBUG_H_) #define _TGS_COLLISION_TOOLS_DEBUG_H_ #pragma once namespace TGS { // START TGS /////////////////////////////////////////////////////////////////////////////////////////////////////// namespace COL { // START COL /////////////////////////////////////////////////////////////////////////////////////////////////////// // ============================================================================================================================== // template <typename TYPE, int DIM> class TTgCOL_DEBUG { public: TgCOMPILER_ASSERT( 3 == DIM || 4 == DIM ) TgTYPE_PREFIX( TYPE ); enum { KTgMAX_CONTACT = 50, KTgMAX_TRI = 150, KTgMAX_DEBUG_POINT=8, KTgMAX_DEBUG_SEGMENT=8, KTgMAX_DEBUG_TRI=8 }; // ---- Member Functions -------------------------------------------------------------------------------------------------------- // public: TTgCOL_DEBUG(); TgVOID Constructor(); //« Initializes object assuming data is invalid. TgVOID Reset(); //« Releases all memory, and initializes object. TgVOID Execute(); // ---- Debug Draw ---------------------------------------------------------------------------------------------------------- // TgVOID Set_ReferenceFrame( const TTgMATRIX<TYPE,3,4>& ); TgVOID Reset_ReferenceFrame(); TgVOID Draw_PC( CR_(PARTICLE,DIM), C_TgUINT32 ); TgVOID Draw_LN( CR_(LINE,DIM), C_TgUINT32 ); TgVOID Draw_RY( CR_(RAY,DIM), C_TgUINT32 ); TgVOID Draw_SG( CR_(SEGMENT,DIM), C_TgUINT32 ); TgVOID Draw_CI( CR_(CIRCLE,DIM), C_TgUINT32 ); TgVOID Draw_DK( CR_(DISK,DIM), C_TgUINT32 ); TgVOID Draw_EL( CR_(ELLIPSE,DIM), C_TgUINT32 ); TgVOID Draw_PT( CR_(PTRI,DIM), C_TgUINT32 ); TgVOID Draw_CT( CR_(CTRI,DIM), C_TgUINT32 ); TgVOID Draw_RT( CR_(RECTANGLE,DIM), C_TgUINT32 ); TgVOID Draw_PM( CR_(PARALLELOGRAM,DIM), C_TgUINT32 ); TgVOID Draw_SP( CR_(SPHERE,DIM), C_TgUINT32 ); TgVOID Draw_BX( CR_(BOX,DIM), C_TgUINT32 ); TgVOID Draw_BA( CR_(BOXAA,DIM), C_TgUINT32 ); TgVOID Draw_CP( CR_(CAPSULE,DIM), C_TgUINT32 ); TgVOID Draw_CY( CR_(CYLINDER,DIM), C_TgUINT32 ); TgVOID Draw_MH( CR_(MESH_AABB,DIM), C_TgUINT32 ); TgVOID Draw_SG( M_(VECTOR,DIM), M_(VECTOR,DIM), C_TgUINT32 ); TgVOID Draw_PT( M_(VECTOR,DIM), M_(VECTOR,DIM), M_(VECTOR,DIM), C_TgUINT32 ); TgVOID Draw_SP( M_(VECTOR,DIM), const TYPE, C_TgUINT32 ); TgVOID Draw_BA( M_(VECTOR,DIM), M_(VECTOR,DIM), C_TgUINT32 ); TgVOID Draw_CY( M_(VECTOR,DIM), M_(VECTOR,DIM), const TYPE, C_TgUINT32 ); TgVOID Draw_CP( M_(VECTOR,DIM), M_(VECTOR,DIM), const TYPE, C_TgUINT32 ); TgVOID Draw_Contact_With_Text( CR_(CONTACT,DIM) ); TgVOID Draw_Contact( CR_(CONTACT,DIM) ); TgVOID Draw_Axis(); TgVOID Draw_Projectile(); TgVOID Render(); TgVOID Reset_Render(); // ---- Debug Control ------------------------------------------------------------------------------------------------------- // TgVOID Reset_Control(); TgVOID Reset_Input(); TgVOID Set_Can_Pause( C_TgBOOL ); TgVOID Set_Pause( C_TgBOOL ); TgVOID Set_Step_Collide( C_TgBOOL ); TgVOID Set_Step_Sim( C_TgBOOL ); TgVOID Set_Skip_Sim( C_TgBOOL ); TgBOOL Query_Can_Pause(); TgBOOL Query_Pause(); TgBOOL Query_Step_Collide(); TgBOOL Query_Step_Sim(); TgBOOL Query_Skip_Sim(); // ---- Projectile Path ----------------------------------------------------------------------------------------------------- // TgVOID Set_Projectile( M_(VECTOR,DIM), M_(VECTOR,DIM), const TYPE ); TgVOID Set_Forcefield( M_(VECTOR,DIM) ); TgVOID Set_Draw_Projectile( C_TgBOOL ); TgBOOL Query_Draw_Projectile(); // ---- Debug Contact Points and Surfaces ----------------------------------------------------------------------------------- // TgVOID Push_Contact( CR_(CONTACT,DIM) ); TgVOID Push_Tri( CR_(PTRI,DIM) ); TgVOID Set_Tri_State( C_TgINT ); TgVOID Set_Mask( C_TgUINT32 ); TgUINT32 Query_Mask(); // ---- Data Members ------------------------------------------------------------------------------------------------------------ // protected: TgBITFIELD32 m_bfFlags; TgINT m_niDraw; //« Number of primitives drawn/processed in the frame. T_(VECTOR,DIM) m_tvS0; //« Projectile source T_(VECTOR,DIM) m_tvT0; //« Projectile target T_(VECTOR,DIM) m_tvV0; //« Projectile launch velocity, calculate data. T_(VECTOR,DIM) m_tvFF, m_tvUFF; //« Forcefield affecting the projectile (most often gravity). TYPE m_tyFF; TYPE m_tyTime; //« Flight time of the projectile TgINT m_niProjectile; //« Number of sections used to render/draw the projectile path. T_(CONTACT,DIM) m_atgContact[KTgMAX_CONTACT]; TgINT m_niContact; T_(PTRI,DIM) m_atgPT[KTgMAX_TRI]; TgINT m_aiID[KTgMAX_TRI]; TgINT m_niTri; TYPE m_tyPush; TgUINT32 m_uiTriMask; TTgMATRIX<TYPE,3,4> m_tmRF; //« Current reference frame for the draw calls. T_(VECTOR,DIM) m_atvPoint[KTgMAX_DEBUG_POINT]; T_(VECTOR,DIM) m_atvSG[KTgMAX_DEBUG_SEGMENT*2]; T_(PTRI,DIM) m_atvPT[KTgMAX_DEBUG_TRI]; enum { ETgFLAG_CAN_PAUSE=0, ETgFLAG_PAUSE, ETgFLAG_STEP_COLLIDE, ETgFLAG_STEP_SIM, ETgFLAG_SKIP_SIM, ETgFLAG_DRAW_PROJECTILE, ETgFLAG_DRAW_NORMAL }; }; // ============================================================================================================================== // }; // END COL ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }; // END TGS ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #endif // END ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////